﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Web;
using System.Data;

namespace StoreLocatorAWC
{
    public class Store
    {
        public int storeID;
        public string storeName;
        public string Address1;
        public string Address2;
        public string city;
        public string postalCode;
        public string state;
        public string country;
        public string lat;
        public string lng;

        public Store()
        { }
        public static List<Store> GetStoresData()
        {
            List<Store> ddlist = new List<Store>();

            DataTable dtList = DataHelper.GetStoresDS().Tables[0];
            DataRow[] drData = dtList.Select();
            foreach (DataRow row in drData)
            {
                Store item = new Store();
                item.storeID = Convert.ToInt32(row["StoreID"]);
                item.storeName = Convert.ToString(row["StoreName"]);
                item.Address1 = Convert.ToString(row["AddressLine1"]);
                item.Address2 = Convert.ToString(row["AddressLine2"]);
                item.city = Convert.ToString(row["City"]);
                item.postalCode = Convert.ToString(row["Postalcode"]);
                item.state = Convert.ToString(row["State"]);
                item.country = Convert.ToString(row["Country"]);
                item.lat = Convert.ToString(row["Latitude"]);
                item.lng = Convert.ToString(row["Longitude"]);

                ddlist.Add(item);
            }
            return ddlist;
        }
        
    }

}
